package com.zhilianbao.leyaogo.http.api;

import android.content.Context;

import com.zhilianbao.leyaogo.constants.HttpConfig;
import com.zhilianbao.leyaogo.http.client.LeYaoGoClient;
import com.zhilianbao.okhttputils.callback.Callback;
import com.zhilianbao.okhttputils.model.JsonParams;

/**
 * Author: hcy
 * Description:购物车相关API
 * Created: 2016/11/16 19:16
 */
public class ShoppingCartApi {

    /**
     * 获取购物车列表
     */
    public static final String I_METHOD_GET_SHOPPING_CART = "shoppingCart/getShoppingCartList";

    /**
     * 设置商品到购物车
     */
    public static final String I_METHOD_SET_SHOPPING_CART = "shoppingCart/setShoppingCart";


    /**
     * 购物车
     *
     * @param context
     * @param userId
     * @param supplierId
     * @param callback
     */
    public static void getShoppingCart(Context context, long userId, long supplierId, Callback callback) {
        JsonParams jsonParams = new JsonParams();
        jsonParams.put("userId", userId);
        jsonParams.put("supplierId", supplierId);
        LeYaoGoClient.post(context, HttpConfig.BASE_URL + I_METHOD_GET_SHOPPING_CART, jsonParams, callback);

    }

    /**
     *设置商品到购物车
    * @param context
     * @param userId
     * @param goodsId
     * @param supplierId
     * @param shopId
     * @param goodsSkuId
     * @param number
     * @param type  0正常流程 1购物车添加
     * @param callback
     */
    public static void setShoppingCart(Context context,long userId, long goodsId,long supplierId,long shopId,long goodsSkuId,
                                       int number,int type,Callback callback){
        JsonParams jsonParams = new JsonParams();
        jsonParams.put("userId", userId);
        jsonParams.put("goodsId", goodsId);
        jsonParams.put("supplierId", supplierId);
        jsonParams.put("shopId", shopId);
        jsonParams.put("goodsSkuId", goodsSkuId);
        jsonParams.put("number", number);
        jsonParams.put("type", type);
        LeYaoGoClient.post(context, HttpConfig.BASE_URL + I_METHOD_SET_SHOPPING_CART, jsonParams, callback);
    }


}
